import { axios, qs } from '@/utils/request'

/**
 * 列表数据
 */
export function list(data) {
  return axios({
    url: '/system/menu/list',
    method: 'post',
    data: qs.stringify(data),
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
}

/**
 *  新增菜单
 */
export function add(data) {
  return axios({
    url: '/system/menu/add',
    method: 'post',
    data
  })
}

/**
 * 更新菜单
 */
export function update(data) {
  return axios({
    url: '/system/menu/update',
    method: 'put',
    data
  })
}

/**
 * 获取角色信息
 */
export function tree() {
  return axios({
    url: '/system/menu/tree',
    method: 'get'
  })
}
/**
 * 通过主键获取菜单信息
 */
export function get(id) {
  return axios({
    url: `/system/menu/get/${id}`,
    method: 'get'
  })
}

/**
 * 删除菜单
 */
export function del(ids) {
  return axios({
    url: '/system/menu/delete',
    method: 'delete',
    data: qs.stringify({ ids }),
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
}
// 菜单图标
export const menuIcons = [
  {
    key: 'brand_logo',
    title: '网站通用图标',
    icons: [
      'lock',
      'unlock',
      'bars',
      'book',
      'calendar',
      'cloud',
      'cloud-download',
      'code',
      'copy',
      'credit-card',
      'delete',
      'desktop',
      'download',
      'ellipsis',
      'file',
      'file-text',
      'file-unknown',
      'file-pdf',
      'file-word',
      'file-excel',
      'file-jpg',
      'file-ppt',
      'file-markdown',
      'file-add',
      'folder',
      'folder-open',
      'folder-add',
      'hdd',
      'frown',
      'thunderbolt',
      'block',
      'cluster',
      'deployment-unit',
      'dollar',
      'euro',
      'pound',
      'file-done',
      'file-exclamation',
      'file-protect',
      'file-search',
      'file-sync',
      'gateway',
      'gold',
      'robot',
      'shopping'
    ]
  },
  {
    key: 'suggested',
    title: '提示建议性图标',
    icons: [
      'question',
      'question-circle',
      'plus',
      'plus-circle',
      'pause',
      'pause-circle',
      'minus',
      'minus-circle',
      'plus-square',
      'minus-square',
      'info',
      'info-circle',
      'exclamation',
      'exclamation-circle',
      'close',
      'close-circle',
      'close-square',
      'check',
      'check-circle',
      'check-square',
      'clock-circle',
      'warning',
      'issues-close',
      'stop'
    ]
  }
]
